package org.nvframe.entity;

import java.util.List;

import org.nvframe.component.Component;

/**
 * 
 * @author Nik Van Looy
 */
public interface Entity {

	public void init();
	
	public void setOwner(Entity owner);
	
	public Entity getOwner();
	
	public Entity getRoot();

	/**
	 * add a component to the entity
	 * 
	 * @param component
	 */
	public void addComponent(Component component);

	/**
	 * returns the first component found from a given classname
	 * 
	 * @param cls
	 * @return component | null
	 */
	public Component getComponent(Class<?> cls);
	
	/**
	 * returns the first component found from a given id
	 * 
	 * @param id
	 * @return component | null
	 */
	public Component getComponent(String id);

	/**
	 * check if an entity instance contains a component of a given class
	 * 
	 * @param cls
	 * @return true if componentclass exists in map
	 */
	public boolean hasComponent(Class<?> cls);
	
	/**
	 * return the component count
	 * 
	 * @return Number of components
	 */
	public int getComponentCount();
	
	/**
	 * print al the components
	 * 
	 * note: currently only for debug purposes
	 */
	public void printAllComponents();
	
	/**
	 * called when an Entity should be removed from memory
	 */
	public void removed();
	
	/**
	 * remove all components from the list
	 */
	public void deleteAllComponents();
	
	public boolean isEnabled();

	public void setEnabled(boolean enabled);

	public String getId();
	
	public String getName();

	public int getInstanceId();

	public void setInstanceId(int instanceId);

	public List<Component> getComponents();

	/**
	 * calls the init-method on itself and all components
	 */
	public void initialize();
	
}
